Learn R Programming

operator.tools (version 1.3.0)

fun2name & name2fun: Convert between a function and its name and vice versa.

Description

fun2name compares a function (body) to all defined functions. If an identical match is found to a defined function, that function is returned. NB. This does not search through S4 methods.

name2fun simply converts its argument to a name and than evals it to produce a function definition

Usage

fun2name(f)
  name2fun(x)

Arguments

f
A function.
x
An object to be converted into a name and eval'd

Value

  • character. A name of the function.

Details

fun2name compares the function against existing functions using identical. If a match is found, the name of the matching function ( expressed as a character ) is returned.

fun2name will not work for S4 Methods.

See Also

identical.

For the S4 methods, see setMethod

Examples

Run this code
# fun2name( ls )

Run the code above in your browser using DataLab